package com.rzcf.blink.pay.trigger.listener;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: dongsufeng
 * @date: 2025/7/12$ 13:14$
 */
@Configuration
public class RabbitMQConfig {

    /**
     * 同步第三方订单，订单同步成功后，发送消息给系统下单
     * ----------------------------------------------------开始---------------------------------------------------------------
     */
    @Bean
    public Queue downstreamOrderSyncQueue() {
        return new Queue(MqConfigConstants.DOWNSTREAM_ORDER_SYNC_QUEUE, true, false, false);
    }

    @Bean
    public DirectExchange downstreamOrderSyncExchange() {
        return new DirectExchange(MqConfigConstants.DOWNSTREAM_ORDER_SYNC_EX);
    }

    @Bean
    public Binding downstreamOrderSyncBinding(Queue vysaTest1Queue, DirectExchange vysaTest1Exchange) {
        return BindingBuilder.bind(vysaTest1Queue).to(vysaTest1Exchange).with(MqConfigConstants.DOWNSTREAM_ORDER_SYNC_ROUTING_KEY);
    }
    //-------------------------------------------------------结束------------------------------------------------------------
}
